﻿using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp.Domain.Entities.Auditing;
using YunDrug.Roles;

namespace YunDrug.EmployeeAuthorization
{
    /// <summary>
    /// 用户信息
    /// </summary>
   public  class Employee:AuditedAggregateRoot<Guid>
    {
        /// <summary>
        /// 登录名称
        /// </summary>
        public string LoginName { get; set; }
        /// <summary>
        /// 用户名称
        /// </summary>
        public string FullName { get; set; }
        /// <summary>
        /// 用户描述
        /// </summary>
        public string Describe { get; set; }
        /// <summary>
        /// 登录密码
        /// </summary>
        public string PassWord { get; set; }
       
        /// <summary>
        /// 机构名称
        /// </summary>
        public string OrganName { get; set; }
        
        /// <summary>
        /// 是否启用
        /// </summary>
        public bool Status { get; set; }
        /// <summary>
        /// 登录次数
        /// </summary>
        public int LoginCount { get; set; }
        /// <summary>
        /// 最后登录时间
        /// </summary>
        public DateTime LastLoginDateTime { get; set; }

        /// <summary>
        /// 用户配置
        /// </summary>
        public virtual List<EmployeeConfig > Config { get; protected set; }

        /// <summary>
        /// 用户所属角色
        /// </summary>
        public virtual  List<EmployeeRole> Roles { get;protected set; }

        //public void AddUserConfig(string code,string name,string value,string describe)
        //{
        //    if (Config == null)
        //    {
        //        Config = new List<EmployeeConfig >();
        //    }
        //    Config.Add(new EmployeeConfig (this.Id, code, name, value, describe));
        //}
        //public void RemoveConfig(string code)
        //{
        //    if (Config != null)
        //    {
        //        Config.RemoveAll(p => p.Code.Equals(code));
        //    }
        //}
        //public void ChangeConfig(string code,string newcode,string name,string value,string describe)
        //{
        //    if (Config != null)
        //    {
        //       var config= Config.Find(p => p.Code.Equals(code));
        //        if (config != null)
        //        {
        //            config.Code = newcode;
        //            config.Name = name;
        //            config.Value = value;
        //            config.Describe = describe;
        //        }
        //    }
        //}
        //public void AddRole(Guid roleId,string rolename)
        //{
           
        //    Roles.Add(new UserForRole(roleId,rolename)); 
        //}

        //public void RemoveRole (Guid roleId)
        //{
        //    Roles.RemoveAll(p => p.RoleCode.Equals(roleId));
            
        //}


    }
}
